using System;
using System.IO;

public static class Program {
   public static void Main() {
      String s1 = "Hello";
      String s2 = "Hello";
      Console.WriteLine(Object.ReferenceEquals(s1, s2));	// Should be 'False'

      s1 = String.Intern(s1);
      s2 = String.Intern(s2);
      Console.WriteLine(Object.ReferenceEquals(s1, s2));	// 'True'
   }

	private static Int32 NumTimesWordAppearsIntern(String word, String[] wordlist) {
		// This method assumes that all entries in wordList refer to interned strings.
		word = String.Intern(word);
		Int32 count = 0;
		for (Int32 wordnum = 0; wordnum < wordlist.Length; wordnum++) {
			if (Object.ReferenceEquals(word, wordlist[wordnum]))
				count++;
		}
		return count;
	}

	private static Int32 NumTimesWordAppearsEquals(String word, String[] wordlist) {
		Int32 count = 0;
		for (Int32 wordnum = 0; wordnum < wordlist.Length; wordnum++) {
			if (word.Equals(wordlist[wordnum], StringComparison.Ordinal))
				count++;
		}
		return count;
	}
}
